<h1>Listing invoices</h1>
<p>
<%= link_to 'New Invoice', new_invoice_path,:class => 'gray-btn' %>
</p>

<table class="datagrid">
  <thead>
    <tr>
      <th>Invoice Id</th>
      <th>Customer</th>
      <th>Issue Date</th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @invoices.each do |invoice| %>
      <tr>
        <td><%= invoice.id %></td>
        <td><%= invoice.customer.company rescue "none" %></td>
        <td><%= invoice.created_at.strftime("%Y-%m-%d") %> </td>
        <td><%= link_to 'Show', invoice %></td>
        <td><%= link_to 'Edit', edit_invoice_path(invoice) %></td>
        <td><%= link_to 'Destroy', invoice, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>

</table>

<br />


